<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/common/common.jspf"%>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/warehouse/outreceipt_all_edit.js"></script>
<style type="text/css">
.col-sm-3 {
	width: 15%;
	float: left;
}

.col-sm-9 {
	width: 85%;
	float: left;
}

label[class^="btn btn-default"] {
	margin-top: -4px;
}
</style>
</head>
<body>
	<div class="l_err" style="width: 100%; margin-top: 2px;"></div>
	<form id="form" name="form" class="form-horizontal" method="post"
		action="${ctx}/outreceipt_all/outreceipt_all_editEntity.shtml">
		<input type="hidden" class="form-control checkacc"
			value="${tInfo.id}" name="transportTransporinfoFormMap.id" id="id"/>
		<!-- 计算TransportTransporinfoFormMap表的noReturnTime字段 -->
		<input type="hidden" class="form-control checkacc"
			value="${tInfo.receiptInterval}" name="transportTransporinfoFormMap.receiptInterval" id="receiptInterval"/>
		<section class="panel panel-default">
		<div class="panel-body">
			<div class="form-group">
				<label class="col-sm-3 control-label">送货日期</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkabh" readonly
						value="${tInfo.tranDate}" />
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">出仓单号</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkabh" readonly
						value="${tInfo.outReceiptNo}" />
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">放行条单号</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkabh" readonly
						value="${tInfo.permitNo}" />
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">客户编号</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkabh" readonly
						value="${tInfo.cid}" />
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">客户名称</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkabh" readonly
						value="${tInfo.cname}" />
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<label class="col-sm-3 control-label">车牌号</label>
				<div class="col-sm-9">
					<input type="text" class="form-control checkabh" readonly
						value="${tInfo.licenseNo}" />
				</div>
			</div>
			<div class="line line-dashed line-lg pull-in"></div>
			
			<!-- 开始打印出仓单 -->
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="panel panel-default">
				<div class="panel-body">
					<table class="table table-bordered">
						<thead>
							<tr>
								<th style="text-align: center;width:176px;">合同编号</th>
								<th style="text-align: center;width:176px;">订单号</th>
								<th style="text-align: center;width:176px;">物料编码</th>
								<th style="text-align: center;width:176px;">仓位</th>
								<th style="text-align: center;width:176px;">业务员</th>
								<th style="text-align: center;width:176px;">模具编码</th>
								<th style="text-align: center;width:176px;">出货数量</th>
								<th style="text-align: center;width:176px;">产品名称</th>
								<th style="text-align: center;width:176px;">入库编号</th>
								<th style="text-align: center;"><input type="button"
									class="btn btn-primary" onclick="insert_row(this)" value="增加"></th>
								<th style="text-align: center;"><input type="button"
									class="btn btn-danger" value="删除"></th>
							</tr>
						</thead>
						<tbody id="tbl">
							<c:forEach var="r" items="${receipt }" varStatus="status">
								<input type="hidden" class="page${status.index+1 }" value="${r.id }">
								<tr>
									<td>
										<div class="input-group">
											<input type="text" class="form-control" style="width: 70px;" readonly
												value="${r.contract_num}">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text" class="form-control" style="width: 70px;" readonly
												value="${r.oid}">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text" class="form-control" style="width: 70px;" readonly
												value="${r.material_code}">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text" class="form-control" style="width: 70px;" readonly
												value="${r.warehouse}">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text" class="form-control" style="width: 70px;" readonly
												value="${r.salesname}">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text" class="form-control" style="width: 100px;" readonly
												value="${r.mold_code}">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text" class="form-control" style="width: 70px;" readonly
												name="outNumber_1" value="${r.outNumber}">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text" class="form-control" style="width: 120px;" readonly
												value="${r.productName}">
										</div>
									</td>
									<td>
										<div class="input-group">
											<input type="text" class="form-control" style="width: 70px;" readonly
												name="eid_1" value="${r.eid}" id="eid">
										</div>
									</td>
									<td><input type="button" class="btn btn-primary"
										onclick="insert_row(this)" value="增加"></td>
									<td><input type="button" class="btn btn-danger"
										onclick="deleteRow(this)" id="page${status.index+1 }" name="pageNo" value="删除"></td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
		</div>
		<footer class="panel-footer text-right bg-light lter">
		<button type="submit" class="btn btn-success btn-s-xs">提交</button>
		</footer> </section>
	</form>
	<script type="text/javascript">
		var i = 0
		function insert_row(obj) {
			i++;
			R = tbl.insertRow(tbl.rows.length);
			C = R.insertCell(0);
			C.innerHTML = '<div class="input-group"><input type="text" style="width: 70px;" class="form-control" name="contract_num_2" id="contract_num_2_'+i+'">'
					+ '<span class="input-group-btn">'
					+ '<button class="btn btn-info" id="planOrder" type="button"style="height: 34px;" '
					+ 'onclick="getItem(\''+i+'\',\'contract_num_2_'+i+'\',\'contract_num\');">'
					+ '<span class="glyphicon glyphicon-search"></span></button></span></div>';
			C = R.insertCell(1);
			C.innerHTML = '<div class="input-group"><input type="text" style="width: 70px;" class="form-control" id="oid_'+i+'" name="oid_2" readonly></div>';
			C = R.insertCell(2);
			C.innerHTML = '<div class="input-group"><input type="text" style="width: 70px;" class="form-control" id="material_code_'+i+'" name="material_code_2" readonly></div>';
			C = R.insertCell(3);
			C.innerHTML = '<div class="input-group"><input type="text" style="width: 70px;" class="form-control" id="warehouse_'+i+'" name="warehouse_2" readonly></div>';
			C = R.insertCell(4);
			C.innerHTML = '<div class="input-group"><input type="text" style="width: 70px;" class="form-control" id="salesname_'+i+'" name="salesname_2" readonly></div>';
			C = R.insertCell(5);
			C.innerHTML = '<div class="input-group"><input type="text" style="width: 100px;" class="form-control" id="mold_code_'+i+'" name="mold_code_2" readonly></div>';
			C = R.insertCell(6);
			C.innerHTML = '<div class="input-group"><input type="text" style="width: 70px;" class="form-control" id="outNumber_'+i+'" name="outNumber_2" readonly></div>';
			C = R.insertCell(7);
			C.innerHTML = '<div class="input-group"><input type="text" style="width: 120px;" class="form-control" id="productName_'+i+'" name="productName_2" readonly></div>';
			C = R.insertCell(8);
			C.innerHTML = '<div class="input-group"><input type="text" style="width: 70px;" class="form-control" id="eid_'+i+'" name="eid_2" readonly></div>';
			C = R.insertCell(9);
			C.innerHTML = '<input type="button" class="btn btn-primary" onclick ="insert_row(this)" value = "增加">';
			C = R.insertCell(10);
			C.innerHTML = '<input type="button" class="btn btn-danger" onclick ="deleteRow(this)" name="pageNo" value ="删除">';
		}
		function deleteRow(obj) {
			$("input[name=pageNo]").each(function(){
				var oid = $(obj).attr("id");
				if(!oid){
					var i = obj.parentNode.parentNode.rowIndex;
					if (i >= 0) {
						tbl.deleteRow(i-1);
					}
					return;
				}
				layer.confirm('是否删除，如曾经发生退货情况，会把相关的退货信息删除？', function(index) {
					var pid=$("."+oid).val();
					//alert($("."+oid).val());
					var tid=$("#id").val();
					var eid=$("#eid").val();
					var url = rootPath + '/outreceipt_all/outreceipt_all_deleteEntity.shtml?pid='+pid+'&tid='+tid+'&eid='+eid;
					var s = CommnUtil.ajax(url, {
					}, "json");
					if (s == "success") {
						var i = obj.parentNode.parentNode.rowIndex;
						if (i >= 0) {
							tbl.deleteRow(i-1);
						}
						layer.msg('删除成功');
						//grid.loadData();
					} else {
						layer.msg('删除失败');
					}
				})
			});
		}
	</script>
</body>
</html>







